package com.atguigu.financial.lease.realtime.util;

import java.util.Properties;

public class KerberosInitor {

    public static Properties getKafkaSasl() {

        String filePath ="C:\\ProgramData\\MIT\\Kerberos5";
        System.setProperty("java.security.auth.login.config", filePath + "\\kafka_client_jaas.conf");
        // linux 环境会默认读取/etc/krb5.conf文件，win不指定会默认读取C:/Windows/krb5.ini
        System.setProperty("java.security.krb5.conf", filePath + "\\krb5.ini");

        Properties props = new Properties();
        // sasl
        props.put("sasl.mechanism", "GSSAPI");
        props.put("security.protocol", "SASL_PLAINTEXT");
        props.put("sasl.kerberos.service.name", "kafka");

        return props;

    }
}
